// 封装商品列表业务逻辑
import { onMounted, ref } from 'vue'
import { getGoodsAPI } from '@/apis/home.js'

export function useProduct() {
  // 获取所有商品
  const goodsProduct = ref([])
  const getGoods = async () => {
    const res = await getGoodsAPI()
    goodsProduct.value = res.result
  }
  onMounted(() => getGoods())

  return {
    goodsProduct
  }
}
